package org.glut.backend.controller;

import lombok.extern.slf4j.Slf4j;
import org.glut.backend.domain.MovieScheduling;
import org.glut.backend.dto.MovieSchedulingDTO;
import org.glut.backend.service.IMovieSchedulingService;
import org.glut.backend.vo.ChooseSeatDetailVO;
import org.glut.backend.vo.MovieSchedulingInfoVO;
import org.glut.backend.vo.PayOrderInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import java.util.List;

/**
 * 电影排片表 前端控制器
 *
 * @author xiuci1412
 * @since 2025-08-01 17:43
 */
@RestController
@RequestMapping("/movieScheduling")
@Slf4j
public class MovieSchedulingController {
    
    @Autowired
    private IMovieSchedulingService movieSchedulingService;

    @GetMapping("/getCinemaInfo/{cinemaId}")
    public ResponseEntity<MovieSchedulingInfoVO> getMovieSchedulingInfoVO(@PathVariable Integer cinemaId) {
        MovieSchedulingInfoVO movieSchedulingInfoVO = movieSchedulingService.getMovieSchedulingInfoVO(cinemaId);
        return ResponseEntity.ok(movieSchedulingInfoVO);
    }

    @PostMapping("/getMovieScheduling")
    public ResponseEntity<List<MovieScheduling>> getMovieScheduling(@RequestBody MovieSchedulingDTO movieSchedulingDTO) {
        List<MovieScheduling> movieSchedulingList = movieSchedulingService.getMovieScheduling(movieSchedulingDTO);
        return ResponseEntity.ok(movieSchedulingList);
    }

    @GetMapping("/getChooseSeat/{id}")
    public ResponseEntity<ChooseSeatDetailVO> getChooseSeat(@PathVariable Integer id) {
        ChooseSeatDetailVO chooseSeatDetailVO = movieSchedulingService.getChooseSeat(id);
        return ResponseEntity.ok(chooseSeatDetailVO);
    }

    @GetMapping("/payOrder/{id}")
    public ResponseEntity<PayOrderInfoVO> payOrder(@PathVariable Integer id) {
        PayOrderInfoVO payOrderInfoVO = movieSchedulingService.payOrder(id);
        return ResponseEntity.ok(payOrderInfoVO);
    }
}